// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    card:'',//手机号,
    name:''
  },
  onGetUserInfo(){
    let that =this;
    wx.showLoading({
      title: '加载中',
      mask:true
    })
    wx.request({
      url: app.globalData.baseUrl + '/api/my/userInfo',
      method: 'GET',
      header: {
        'content-type': 'application/x-www-form-urlencoded',
        'token':app.globalData.token,
      },
      success: function(res) {  
        wx.hideLoading()    
        if(res.data.status){
          that.setData({
            card : res.data.data.records.get_driver_info.id_card,
            name : res.data.data.records.get_driver_info.name
          })
        }
      },
      fail: function() {
        wx.hideLoading()    
        console.log("请求失败")
      }
    })
  },
  onLoad(){
    this.onGetUserInfo()
  
  }
})
